﻿<Application
    x:Class="Reference.Apps.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Reference.Apps"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewModels="using:Reference.Apps.ViewModels"
    xmlns:converters="using:Reference.Apps.Converters"
    RequestedTheme="Light"
    mc:Ignorable="d">
    
    <Application.Resources>
        <viewModels:ViewModelLocator x:Key="VMLocator" d:IsDataSource="True" />
        <converters:LangToLanguageConverter x:Key="Lang2Language" />
        <converters:LangToSolidColorBrushConverter x:Key="Lang2Brush" />
        <converters:UppercaseConverter x:Key="UpperConverter" />
        <converters:LowercaseConverter x:Key="LowerConverter" />
        <converters:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
        <SolidColorBrush x:Key="ApplicationPageBackgroundBrush" Color="#E3E3E8"/>
		<SolidColorBrush x:Key="ApplicationContrastBackgroundBrush" Color="#39393B" />
        <SolidColorBrush x:Key="ApplicationContrastBackgroundTransparetBrush" Color="#C839393B" />
		<!-- Color resources -->
        <Style x:Key="HeaderTxtBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource HeaderTextBlockStyle}">
            <Setter Property="Foreground" Value="#39393B" />
        </Style>
		<Style x:Key="SubheaderTxtBlockStyle" TargetType="TextBlock" BasedOn="{StaticResource SubheaderTextBlockStyle}">
            <Setter Property="Foreground" Value="#39393B" />
		</Style>
        <Style x:Key="MyButtonResource" TargetType="Button">
        	<Setter Property="Foreground" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
        	<Setter Property="VerticalAlignment" Value="Top"/>
        	<Setter Property="HorizontalAlignment" Value="Left"/>
        	<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
        	<Setter Property="FontWeight" Value="Normal"/>
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="Button">
        				<Grid x:Name="RootGrid" Background="Transparent">
        					<VisualStateManager.VisualStateGroups>
        						<VisualStateGroup x:Name="CommonStates">
        							<VisualState x:Name="Normal"/>
        							<VisualState x:Name="PointerOver">
        								<Storyboard>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="Ellipse">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPointerOverBackgroundThemeBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Content">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationContrastBackgroundBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        								</Storyboard>
        							</VisualState>
        							<VisualState x:Name="Pressed">
        								<Storyboard>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="Ellipse">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="Ellipse">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="Content">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPressedForegroundThemeBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        								</Storyboard>
        							</VisualState>
        							<VisualState x:Name="Disabled">
        								<Storyboard>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="RootGrid">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
        									</ObjectAnimationUsingKeyFrames>
        								</Storyboard>
        							</VisualState>
        						</VisualStateGroup>
        						<VisualStateGroup x:Name="FocusStates">
        							<VisualState x:Name="Focused">
        								<Storyboard>
        									<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisualWhite"/>
        									<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisualBlack"/>
        								</Storyboard>
        							</VisualState>
        							<VisualState x:Name="Unfocused"/>
        							<VisualState x:Name="PointerFocused"/>
        						</VisualStateGroup>
        					</VisualStateManager.VisualStateGroups>
        					<Grid Height="41" Width="41">
        						<Ellipse x:Name="Ellipse" Fill="#cecece" Stroke="{TemplateBinding Foreground}" StrokeThickness="2" UseLayoutRounding="False"/>
        						<ContentPresenter x:Name="Content" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        							<PathIcon Data="F1 M 17.4126,18L 24.0752,11L 17.6558,11L 8.77931,20.4678L 8.77931,20.5322L 17.6558,30L 24.0752,30L 17.4126,23L 32,23L 32,18L 17.4126,18 Z "/>
        						</ContentPresenter>
        					</Grid>
        					<Rectangle x:Name="FocusVisualWhite" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="1.5" StrokeEndLineCap="Square" Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}" StrokeDashArray="1,1"/>
        					<Rectangle x:Name="FocusVisualBlack" IsHitTestVisible="False" Opacity="0" StrokeDashOffset="0.5" StrokeEndLineCap="Square" Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}" StrokeDashArray="1,1"/>
        				</Grid>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        </Style>
        <!-- Data templates -->

        <DataTemplate x:Key="WCodeSnippetTemplate">
            <Grid Width="300" Margin="10" VerticalAlignment="Center" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Border Background="{Binding Lang, Converter={StaticResource Lang2Brush}}" Width="60" Height="60">
                    <TextBlock Foreground="White" Text="{Binding Lang, Converter={StaticResource Lang2Language}}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="21.333" />
                </Border>
                <TextBlock Grid.Column="1" Text="{Binding Title}" Style="{StaticResource SubheaderTextBlockStyle}" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="{StaticResource ApplicationContrastBackgroundBrush}"/>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="WPCodeSnippetTemplate">
            <Grid Margin="0,10,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Border Background="{Binding Lang, Converter={StaticResource Lang2Brush}}" Height="50"  Width="50">
                    <TextBlock Text="{Binding Lang, Converter={StaticResource Lang2Language}}" Foreground="#FFFFFF" VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="Segoe UI Semibold" FontSize="20"/>
                </Border>

                <TextBlock Text="{Binding Title}" Grid.Column="1" Style="{ThemeResource ListViewItemTextBlockStyle}" Margin="10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="{StaticResource ApplicationContrastBackgroundBrush}"/>
                
            </Grid>
        </DataTemplate>
    </Application.Resources>

</Application>
